package rhc.taskSchedule.entity;

import java.util.Date;
import java.util.List;

import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

/**
 * 任务调度类，每一个任务都可以关联上任务调度，然后统一调度
 * 
 * @author lenovo
 *
 */
@Document(collection = "distribute_task_schedule")
abstract public class TaskSchedule extends AbstractEntity {
	
	/**
	 * 运行调度节点标识
	 */
	public static final String RUN_NODE_LABEL="schedule";

	public static final String COLUMN_TASK_SCHEDULE_NAME = "task_schedule_name";
	public static final String COLUMN_SCHEDULE_CODE = "schedule_code";
	public static final String COLUMN_RUN_COUNT = "run_count";
	public static final String COLUMN_CREATE_DATE = "create_date";
	public static final String COLUMN_UPDATE_DATE = "update_date";
	public static final String COLUMN_BEFORE_RUN_DATE = "before_run_date";
	public static final String COLUMN_TASK_LIST = "task_list";
	public static final String COLUMN_START_NOW = "start_now";

	public TaskSchedule(String scheduleCode) {
		this.scheduleCode = scheduleCode;
	}

	/**
	 * 任务调度名
	 */
	@Field(value = COLUMN_TASK_SCHEDULE_NAME)
	private String taskScheduleName;

	/**
	 * 调度类型
	 */
	@Field(value = COLUMN_SCHEDULE_CODE)
	private String scheduleCode;

	/**
	 * 运行次数，每一次调度后加1
	 */
	@Field(value = COLUMN_RUN_COUNT)
	private int runCount;

	/**
	 * 创建时间
	 */
	@Field(value = COLUMN_CREATE_DATE)
	private Date createDate;

	/**
	 * 更新时间
	 */
	@Field(value = COLUMN_UPDATE_DATE)
	private Date updateDate;

	/**
	 * 上次运行时间
	 */
	@Field(value = COLUMN_BEFORE_RUN_DATE)
	private Date beforeRunDate;

	/**
	 * 关联任务列表
	 */
	@Field(value = COLUMN_TASK_LIST)
	private List<String> taskList;

	/**
	 * 是否启动时立即执行
	 */
	@Field(value = COLUMN_START_NOW)
	private boolean startNow;

	public String getTaskScheduleName() {
		return taskScheduleName;
	}

	public void setTaskScheduleName(String taskScheduleName) {
		this.taskScheduleName = taskScheduleName;
	}

	public String getScheduleCode() {
		return scheduleCode;
	}

	public void setScheduleCode(String scheduleCode) {
		this.scheduleCode = scheduleCode;
	}

	public boolean isStartNow() {
		return startNow;
	}

	public void setStartNow(boolean startNow) {
		this.startNow = startNow;
	}

	public int getRunCount() {
		return runCount;
	}

	public void setRunCount(int runCount) {
		this.runCount = runCount;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Date getBeforeRunDate() {
		return beforeRunDate;
	}

	public void setBeforeRunDate(Date beforeRunDate) {
		this.beforeRunDate = beforeRunDate;
	}

	public List<String> getTaskList() {
		return taskList;
	}

	public void setTaskList(List<String> taskList) {
		this.taskList = taskList;
	}

}
